package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.domain.SysJob;
import com.ruoyi.system.api.factory.RemoteJobFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(contextId = "remoteJobService", value = ServiceNameConstants.SYS_JOB,
        fallbackFactory = RemoteJobFallbackFactory.class)
public interface RemoteJobService {
    @GetMapping("/job/addJob")
    Long addTask(@RequestBody SysJob job, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PutMapping("/job/runStartAt")
    AjaxResult runStartAt(@RequestBody SysJob job,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
